{include file="public/layout" /}

<body style="overflow: auto; cursor: default; -moz-user-select: inherit;background-color:#F4F4F4;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="member/left" /}

<div id="geduan_div" class="h15"></div>
<div class="page" style="min-width:auto;margin-left:115px;">
    <div class="flexigrid flexigrid-xin">
        <div class="header-bar">
            <div class="more">
                <div class="search">
                    <div class="content">
                        <form id="searchForm" action="{:url('UsersMoney/money_index')}" method="get"
                              onsubmit="layer_loading('正在处理');" style="display: unset;">
                            {$searchform.hidden|default=''}
                            <div class="ey-form-item"><label class="users-form-item-label">关键词：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <div class="sDiv2">
                                                <input type="text" size="50" name="keywords"
                                                       value="{$Request.param.keywords}" class="qsbox"
                                                       style="width: 170px;" placeholder="用户名">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="ey-form-item"><label class="users-form-item-label">变动规则：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <div class="">
                                                <select name="type" id="type" onchange="changeType(this);">
                                                    <option value="0" {if condition=" !$Request.param.type" }selected{/if}>全部</option>
                                                    <option value="1" {if condition=" 1 == $Request.param.type" }selected{/if}>收入</option>
                                                    <option value="2" {if condition=" 2 == $Request.param.type" }selected{/if}>消耗</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!-- <div class="ey-form-item"><label class="users-form-item-label">变动原因：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <div class="">
                                                <select name="cause_type" id="cause_type">
                                                    <option value="-1" {if condition=" -1 == $Request.param.cause_type" }selected{/if}>全部</option>
                                                    {volist name="$pay_cause_type_arr" id="ul"}
                                                    {if condition="($Request.param.type == 1 && in_array($key,[1,4]) ) || ($Request.param.type == 2 && in_array($key,[0,2,3,5])) || !$Request.param.type"}
                                                    <option value="{$key}" {if condition='$Request.param.cause_type == $key' }selected{/if}>{$ul}</option>
                                                    {/if}
                                                    {/volist}

                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div> -->

                            <div class="ey-form-item"><label class="users-form-item-label">会员级别：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <div class="">
                                                <select name="level" id="level">
                                                    <option value="" {if condition="!$Request.param.level" }selected{/if}>全部</option>
                                                    {volist name="$usersLevel" id="ul"}
                                                    <option value="{$ul.level_id}" {if condition='$Request.param.level == $ul.level_id' }selected{/if}>{$ul.level_name}</option>
                                                    {/volist}
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
    
                            <div class="ey-form-item"><label class="users-form-item-label">操作时间：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <div class="sDiv2">
                                                <input type="text" name="add_time" id="eYLaydateTimeLinkage" data-max_date="{php}echo date('Y-m-d');{/php}" autocomplete="off"  class="qsbox" placeholder="余额操作时间" lay-key="1" style="width: 220px;" value="{$Request.param.add_time}">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="ey-form-item" style="margin-left: 20px;">
                                <div class="users-form-item-content">
                                    <span class="bt-xin" onclick="OrderQuery();">查询</span>
                                    <span class="bt-xin-no" onclick="OrderQuery('reset');">重置</span>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="geduan-xin"></div>
    <div class="flexigrid  flexigrid-xin">
        <div class="tableDiv " style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table cellspacing="0" cellpadding="0" style="width: 100%">
                    <thead>
                    <tr>
                        <th abbr="article_title" axis="col3" class="">
                            <div class="">用户</div>
                        </th>
                        <th abbr="ac_id" axis="col4" class="w200">
                            <div class="tc">变动金额</div>
                        </th>
                        <th abbr="article_title" axis="col3" class="w200">
                            <div class="tc">变动后余额</div>
                        </th>
                        <th abbr="article_title" axis="col3" class="w100">
                            <div class="tc">变动类别</div>
                        </th>
                        <!-- <th abbr="article_title" axis="col3" class="w200">
                            <div class="tc">变动原因</div>
                        </th -->
                        <th abbr="ac_id" axis="col4" class="w160">
                            <div class="tc">操作时间</div>
                        </th>
                    </tr>
                    </thead>
                    <tbody class="no-border">
                    {empty name="list"}
                    <tr>
                        <td class="no-data" align="center" axis="col0" colspan="50">
                            <div class="no_row">
                                <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
                            </div>
                        </td>
                    </tr>
                    {else/}
                    {foreach name="list" item="vo" key="k" }
                    <tr>
                        <td class="sort">
                            <div class="text-l10 tl">
                                <img id="img_head_pic" class="fl" style="width: 40px; height: 40px;" src="{$vo.head_pic|get_head_pic=###,false,$vo['sex']}" />
                                <p style="margin-top: -5px;">
                                    {eq name="'Member@users_edit'|is_check_access" value="1"}
                                    <a href="javascript:void(0);" data-href="{:url('Member/users_edit', ['id'=>$vo.users_id,'from'=>'money_index','iframe'=>1])}" onclick="openFullframe(this, '会员资料','100%','100%');">{$vo.username}</a>
                                    {else /}
                                    {$vo.username}
                                    {/eq}
                                </p>
                                <p class="binding">
                                    <span class="fl ml10 mtf5">{$usersLevel[$vo.level]['level_name']}</span>
                                </p>
                            </div>
                            
                        </td>
                        <td>
                            <div class="tc">
                                {in name='$vo.cause_type' value='$add_type'}
                                <b style="color: #19be6b;">+￥{$vo.money}</b>
                                {else /}
                                <b style="color: red;">-￥{$vo.money}</b>
                                {/in}
                            </div>
                        </td>
                        <td class="sort">
                            <div class="tc"> ￥{$vo.users_money}</div>
                        </td>
                        <!-- <td>
                            <div class="tc">
                                {in name='$vo.cause_type' value='$add_type'}
                                增加
                                {else /}
                                减少
                                {/in}
                            </div>
                        </td> -->
                        <td class="sort">
                            <div class="tc">
                                <a href="{:url('UsersMoney/eyou_money_recharge_index',['cause_type'=>$vo.cause_type])}">
                                    {$pay_cause_type_arr[$vo.cause_type]}
                                </a>
                            </div>
                        </td>
                        
                        <td>
                            <div class="tc"> {$vo.add_time|date='Y-m-d H:i:s',###}</div>
                        </td>

                    </tr>
                    {/foreach}
                    {/empty}
                    </tbody>
                </table>
            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        {notempty name="list"}
        <div class="tDiv">
            <div class="tDiv2">
                <div class="fbuttonr" style="float: left;width: 450px;">
                    <div class="total">
                        <h5>当前列表共{$list_row}条数据，总充值金额：￥{$total_add_money}，总消耗金额：￥{$total_reduce_money}</h5>
                    </div>
                </div>
                {include file="public/page" /}
            </div>
            <div style="clear:both"></div>
        </div>
        {/notempty}
    </div>
</div>

<script type="text/javascript">
    $(function () {

        $(document).keydown(function(event){
            if (event.keyCode ==13) {
                $('#searchForm input[type=text]').each(function(index, item){
                    if ($(item).is(':focus')) {
                        $('#searchForm').submit();
                    }
                });
            }
        });
        
        $('input[name*=ids]').click(function () {
            if ($('input[name*=ids]').length == $('input[name*=ids]:checked').length) {
                $('.checkAll').prop('checked', 'checked');
            } else {
                $('.checkAll').prop('checked', false);
            }
        });
        $('input[type=checkbox].checkAll').click(function () {
            $('input[type=checkbox]').prop('checked', this.checked);
        });
    });

    $(document).ready(function () {
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function () {
            $(this).toggleClass('trSelected');
        });
    });

    // 订单查询
    function OrderQuery(isReset) {
        if (isReset && 'reset' == isReset) {
            window.location.href = "{:url('UsersMoney/eyou_money_recharge_index', ['cause_type'=>-1])}";
        } else {
            $('#searchForm').submit();
        }
    }

    function changeType(obj) {
        $('#cause_type').find("option[value='-1']").attr("selected",true);
    }

</script>

<!-- 日期联动选择js文件 start -->
{eyou:static file="/public/static/common/js/ey_laydate_time_linkage.js"/}
<!-- 日期联动选择js文件 end -->

{include file="public/footer" /}